package com.gwnet.shop.service.impl;

import java.util.List;

import com.gwnet.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.gwnet.shop.mapper.ShopNoticeMapper;
import com.gwnet.shop.domain.ShopNotice;
import com.gwnet.shop.service.IShopNoticeService;

import javax.annotation.Resource;

/**
 * 通知(公告)Service业务层处理
 * 
 * @author 张万鹏
 * @date 2024-07-29
 */
@Service
public class ShopNoticeServiceImpl implements IShopNoticeService 
{
    @Resource
    private ShopNoticeMapper shopNoticeMapper;

    /**
     * 查询通知(公告)
     * 
     * @param id 通知(公告)主键
     * @return 通知(公告)
     */
    @Override
    public ShopNotice selectShopNoticeById(Long id)
    {
        return shopNoticeMapper.selectShopNoticeById(id);
    }

    /**
     * 查询通知(公告)列表
     * 
     * @param shopNotice 通知(公告)
     * @return 通知(公告)
     */
    @Override
    public List<ShopNotice> selectShopNoticeList(ShopNotice shopNotice)
    {
        //只显示正在展示的
        return shopNoticeMapper.selectShopNoticeList(shopNotice);
    }

    /**
     * 新增通知(公告)
     * 
     * @param shopNotice 通知(公告)
     * @return 结果
     */
    @Override
    public int insertShopNotice(ShopNotice shopNotice)
    {
        shopNotice.setCreateTime(DateUtils.getNowDate());
        return shopNoticeMapper.insertShopNotice(shopNotice);
    }

    /**
     * 修改通知(公告)
     * 
     * @param shopNotice 通知(公告)
     * @return 结果
     */
    @Override
    public int updateShopNotice(ShopNotice shopNotice)
    {
        shopNotice.setUpdateTime(DateUtils.getNowDate());
        return shopNoticeMapper.updateShopNotice(shopNotice);
    }

    /**
     * 批量删除通知(公告)
     * 
     * @param ids 需要删除的通知(公告)主键
     * @return 结果
     */
    @Override
    public int deleteShopNoticeByIds(Long[] ids)
    {
        return shopNoticeMapper.deleteShopNoticeByIds(ids);
    }

    /**
     * 删除通知(公告)信息
     * 
     * @param id 通知(公告)主键
     * @return 结果
     */
    @Override
    public int deleteShopNoticeById(Long id)
    {
        return shopNoticeMapper.deleteShopNoticeById(id);
    }
}
